#pragma once

#include "../engine/SmartPtr.h"
#include "../engine/IRenderer.h"
#include "../engine/Scene.h"
#include "OpenGLContext.h"
#include "CvarWrapper.h"
#include "CameraWrapper.h"
#include "ModelWrapper.h"

using System::String;

class DemoContexData
{
public:
	RendererPtr renderer;
	ScenePtr    scene;
};

public ref class DemoContext : public OpenGLContext
{
public:
	event System::EventHandler ^Initialized;

	~DemoContext();

	virtual void OnInitialized() override;

	virtual void Draw() override;

	void UpdateSize();

	CvarWrapper^ GetCvar(String^ name, bool createIfNotExists);

	CvarWrapper^ GetCvar(String^ name);

	CvarWrapper^ CreateCvar(String^ name, int defaultValue);
	CvarWrapper^ CreateCvar(String^ name, bool defaultValue);
	CvarWrapper^ CreateCvar(String^ name, float defaultValue);

	void LoadMeshModel(String^ file);

	void LoadCamera(
		float eye_x, float eye_y, float eye_z,
		float at_x, float at_y, float at_z,
		float up_x, float up_y, float up_z
	);

	CameraWrapper^ GetActiveCamera();

	ModelWrapper^ GetActiveModel();

protected:
	virtual bool IsInputKey(System::Windows::Forms::Keys keyData) override;	

private:
	DemoContexData* _data;
};

